#ifndef __EI_SMART_RECG_H__
#define __EI_SMART_RECG_H__

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */

#include "ei_mai_smart_face.h"

/**
 * @brief get face feature face image type
 */
typedef enum {
	SMART_IMAGE_FORMAT_NV12 = 0, /**< image format nv12 */
	SMART_IMAGE_FORMAT_JPEG, /**< image format jpeg */
} EI_MADP_SMART_IMAGE_E;

typedef struct eiMADP_SMART_JPEG_DATA_S {
	EI_U8 *u8ImageData; /**< image data */
	EI_U32 u32ImageSize; /**< image size */
} EI_MADP_SMART_JPEG_DATA_S;

/**
 * @brief get face feature face image
 */
typedef struct eiMADP_SMART_FACERECG_IMAGE_S {
	EI_MADP_SMART_IMAGE_E eFormat; /**< image format */
	union {
		EI_MADP_SMART_JPEG_DATA_S stJPEGData;
		EI_NNA_FRAME_DATA_S stFrameData;
	};
	EI_S32 s32FaceId;
	/**< If set Rect kpts param, recg image will not be det face */
	/**< attr mask */
	EI_S32 s32Rect[4]; /**< face det rect[4] */
	EI_FLOAT f32Score; /**< face det score */
	EI_FLOAT f32Kpts[10]; /**< face kpts[10] */
	EI_S32 s32Clarity;
} EI_MADP_SMART_FACERECG_IMAGE_S;

/**
 * @brief face feature
 */
typedef struct eiMADP_SMART_FACEFEAT_S {
	EI_S8 s8Feature[NNA_FACE_RECG_FEATURE_SIZE]; /**< 1024 feature*/
	EI_FLOAT f32Norm[2];
} EI_MADP_SMART_FACEFEAT_S;

/**
 * @brief face recg compare result
 */
typedef struct eiMADP_SMART_FACERECG_RESULT_S {
	EI_S32 s32Mask;
	/**< compare score 0~1 , top1 - top2 > 0.15:  threshold 0.38, top1 - top2 > 0.15: mask threshold 0.42 */
	EI_FLOAT f32Score[3];
	EI_S32 s32MaxID[3]; /**< id in the registrant face feature database */
	EI_S32 s32Version; /**< register version for conflict */
} EI_MADP_SMART_FACERECG_RESULT_S;

/**
 * @brief Face feature value
 */
typedef struct eiMADP_SMART_FEATURE_S {
	EI_S8 s8Feature[NNA_FACE_RECG_FEATURE_SIZE];
} EI_MADP_SMART_FEATURE_S;

typedef struct eiMADP_SMART_NORM_S {
	EI_FLOAT f32Norm[2];
} EI_MADP_SMART_NORM_S;

typedef struct eiMADP_SMART_SCORE_S {
	EI_FLOAT f32Score;
} EI_MADP_SMART_SCORE_S;

/**
 * @brief Face key porint info
 */
typedef struct eiMADP_SMART_KPT_S {
	EI_FLOAT f32Kpts[10];
} EI_MADP_SMART_KPT_S;

/**
 * @brief Face feature info
 *
 * @note a face has two f32Norm
 */
typedef struct eiMADP_SMART_FEATURES_S {
	EI_MADP_SMART_FEATURE_S *pstFeature;	/**< face feature array */
	EI_MADP_SMART_NORM_S *pstNorm;
	EI_MADP_SMART_SCORE_S *pstScore;
	EI_S32 s32Cnt;	/**< face Features count in all */
	EI_S32 s32Version; /**< register version for conflict */
} EI_MADP_SMART_FEATURES_S;

typedef struct eiMADP_SMART_FACECAP_RECG_FRAME_S {
	EI_MADP_SMART_FACESNAP_RESULTS_S stFaceSnap;
} EI_MADP_SMART_FACECAP_RECG_FRAME_S;

typedef struct eiMADP_SMART_FACECAP_RECG_resultS_S {
	EI_MADP_SMART_FACERECG_RESULT_S *pstResult;
	EI_MADP_SMART_FACECAP_RECG_FRAME_S *pstFaceCapRecgFrame;
} EI_MADP_SMART_FACECAP_RECG_RESULTS_S;

typedef EI_S32 (*EI_MADP_SMART_FaceCap_RecgDataCB)(EI_HANDLE hFaceCap,
	EI_MADP_SMART_FACECAP_RECG_RESULTS_S *pstSmartFaceRecgResults, EI_VOID *pPrivData);

/**
 * @brief the attribute of smart face recg
 */
typedef struct eiMADP_SMART_FACERECG_ATTR_S {
	EI_HANDLE hFaceRecg;
	EI_HANDLE hFaceDet; /**< face det handle */
	EI_HANDLE hFaceCap;
	EI_HANDLE VdecChn;
	EI_U32 u32Step;
	EI_FLOAT f32FaceRecgThreshold;

	EI_S32 s32RecgEnable;
	EI_S32 s32RecgMinPixel;
	EI_S32 s32RecgMaxPixel;
	EI_S32 s32RecgYaw;
	EI_S32 s32RecgPitch;
	EI_S32 s32RecgRoll;
	EI_S32 s32RecgClarityThreshold;
	EI_S32 s32RecgClarityMaskThreshold;
	EI_S32 s32RegImageClarityThreshold;

	EI_S32 s32MaskRecgEnable;
	EI_FLOAT f32FaceMaskRecgThreshold;

	EI_MADP_SMART_FaceCap_RecgDataCB pfnDataCB;
	EI_VOID *pPrivateData;
} EI_MADP_SMART_FACERECG_ATTR_S;

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */

#endif /* __EI_SMART_RECG_H__ */
